#ifndef _ANDFILTER_H_
#define _ANDFILTER_H_

#include <filter/PacketFilter.h>

#include <vector>

class Packet;

/**
 * Implements the logical AND operation over two or more packet filters.
 * In other words, packets pass this filter if they pass <b>all</b> of the filters.
 *
 * @author Matt Tucker
 */
class AndFilter : public PacketFilter {
public:
    /**
     * Creates an empty AND filter. Filters should be added using the
     * {@link #addFilter(PacketFilter)} method.
     */
    AndFilter() {}
	
    /**
     * Creates an AND filter using the specified filters.
     *
     * @param filters the filters to add.
     */
    AndFilter(std::vector<PacketFilter*> & filters) {};
    AndFilter(PacketFilter*, PacketFilter*);
	
    /**
     * Adds a filter to the filter list for the AND operation. A packet
     * will pass the filter if all of the filters in the list accept it.
     *
     * @param filter a filter to add to the filter list.
     */
    void addFilter(PacketFilter * filter);
	
	bool accept(Packet * packet);

private:
    /**
     * The list of filters.
     */
	std::vector<PacketFilter*> filters;
};

#endif // -- _ANDFILTER_H_
